package com.itheima;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        //完成评委打分
        System.out.println("当前选手的得分为"+getAverageScore(5));
    }
    public static double getAverageScore(int number) {
        int[] scores =new int[number];

        Scanner sc =new Scanner(System.in);

        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第"+(i+1)+"个评委的打分");
            int score = sc.nextInt();
            scores[i] = score;
        }

        int sum = 0;
        int max = scores[0];
        int min = scores[0];

        for (int i = 0; i < scores.length; i++) {
            int score = scores[i];
            sum += score;
            if(score > max){
                max = score;
            }
            if(score < min){
                min = score;
            }
        }
        return 1.0* (sum - max - min) / (scores.length - 2);
    }
}
